package org.example3;

public class TestAnimal {
 public static void main(String[] args) {
     Animal a = new Animal("Pluto", 10);
     Cat c = new Cat("Garfield", 6);
     Dog d = new Dog("Fido", 4);


    // Animal a2 = new Dog("Fido", 4);
     //Dog dog2 = (Dog) a;
     //Dog dog3 = (Dog) a2;

     //Integer x = (Integer) a;


//     a.greet(); // Animal Pluto says: Huh?______________________
//     c.greet(); // Animal Pluto says: Huh?______________________
//     d.greet(); // ______________________
//     c.play(); // ______________________
//     c.play(":)"); // ______________________


    // c =  a; error
      a = c;
//       a.greet();  //Cat Garfield says: Meow!
//       a.play();   //Woo it is so much fun being an animal!
//
//     a =(Animal) c;
//     ((Animal)a).greet();  //Cat Garfield says: Meow!
//     a.play();   //Woo it is so much fun being an animal!

     /**
      * Exception in thread "main" java.lang.ClassCastException: org.example3.Animal cannot be cast to org.example3.Cat
      * 	at org.example3.TestAnimal.main(TestAnimal.java:25)
      */
     ((Cat) a).greet(); // ______________________
     ((Cat) a).play(":D"); // ______________________
     // a.play(14);


//        a.play(14); // ______________________
        ((Dog) a).play(12); // ______________________
//         a.greet(); // ______________________
       //a c = (Cat) a; // ______________________
//         }
    }
}
